<template>
  <h3>我是app组件</h3>
  <h2>姓名:{{ name }}</h2>
  <h2>年龄:{{ age }}</h2>
  <button @click="changeInfo">修改这些人的信息</button>
</template>

<script>

import {ref} from "vue";

export default {
  name: 'App',
  setup() {
    let name = ref('张三')
    let age = ref(18)

    //方法
    function changeInfo() {
      name.value = '李四'
      age.value = 20
      console.log(name, age)
    }

    return {
      name,
      age,
      changeInfo,
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
